package com.echo.blog.business.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * <p>
 * </p>
 *
 * @author chentl123
 * @since 2019-05-28
 */
@JsonIgnoreProperties({"handler", "hibernateLazyInitializer"})
@TableName("sys_user")
public class SysUser extends Model<SysUser> implements Serializable {

    private static final long serialVersionUID = 1L;

    public SysUser() {
    }

    //注册用户专用构造
    public SysUser(String username, String name, String password, String salt, String signature, String phone, String address, String sex, Integer age, String avatar, String role) {
        this.username = username;
        this.name = name;
        this.password = password;
        this.salt = salt;
        this.signature = signature;
        this.phone = phone;
        this.address = address;
        this.sex = sex;
        this.age = age;
        this.avatar = avatar;
        this.role = role;
    }

    public SysUser(Integer thirdId, String username, String name, String password, String salt, String avatar, String role) {
        this.thirdId = thirdId;
        this.username = username;
        this.name = name;
        this.password = password;
        this.salt = salt;
        this.avatar = avatar;
        this.role = role;
    }


    /**
     * 用戶id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 第三方id
     */
    private Integer thirdId;
    /**
     * 账户名称
     */
    private String username;
    /**
     * 用户姓名
     */
    private String name;
    /**
     * 密码
     */
    private String password;
    /**
     * 密码盐
     */
    private String salt;
    /**
     * 个性签名
     */
    private String signature;
    /**
     * 电话
     */
    private String phone;
    /**
     * 地址
     */
    private String address;
    /**
     * 性别
     */
    private String sex;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 头像地址
     */
    private String avatar;
    /**
     * 角色
     */
    private String role;

    /**
     * 注册时间
     */
    private Date createTime;

    /**
     * 令牌
     */
    @TableField(exist = false)
    private String access_token;
    /**
     * 刷新token
     */
    @TableField(exist = false)
    private String refresh_token;

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getAccess_token() {
        return access_token;
    }

    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }

    public String getRefresh_token() {
        return refresh_token;
    }

    public void setRefresh_token(String refresh_token) {
        this.refresh_token = refresh_token;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public Integer getThirdId() {
        return thirdId;
    }

    public void setThirdId(Integer thirdId) {
        this.thirdId = thirdId;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "id=" + id +
                ", thirdId=" + thirdId +
                ", username='" + username + '\'' +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", signature='" + signature + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                ", avatar='" + avatar + '\'' +
                ", role='" + role + '\'' +
                ", access_token='" + access_token + '\'' +
                ", refresh_token='" + refresh_token + '\'' +
                '}';
    }
}
